package no.gnet.edvd.statemachine;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;

import javax.sql.DataSource;

import no.gnet.edvd.database.mysql.MySQLDatastore;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
	
	ApplicationContext context = new ClassPathXmlApplicationContext("/statemachine-context.xml");

	
	protected DataSource datasource = null;
	
	MySQLDatastore mysqlds = null;
	
	public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException{
        System.out.println("Initializing Spring context.");
        new ClassPathXmlApplicationContext("/statemachine-context.xml");
        System.out.println("Spring context initialized.");
	}
	
	public Main() throws UnsupportedEncodingException, NoSuchAlgorithmException{
		datasource = (DataSource) context.getBean("dataSource");
		mysqlds = new MySQLDatastore(datasource);
	}

}
